###定义函数###
def divide():
    for i in range(2, 10):
        nu = 0
        for j in range(len(nums)):
            if nums[j] % i == 0:
                nu += 1
            else:
                break

        if nu == len(nums):
            for k in range(len(nums)):
                nums[k] = int(nums[k] / i)
        else:
            continue
    return

###接受用户输入n个数字###
nums = []
num = int(input("请输入一个正整数："))
num0 = num
while num != 0:
    nums.append(num)
    num = int(input("请继续输入正整数(输入0结束输入):"))
inums = nums[:]
###开始调用函数###
divide()
while inums != nums:
    inums = nums[:]
    divide()
###求最终列表中的元素乘积###
product = 1
for i in nums:
    product *= i
# print(nums)
print("这{}个数的最小公倍数是{}，最大公约数是{}".format(len(nums), int(num0/nums[0]), int(num0/nums[0]*product)))
